package com.lucy.viewer.config;

import cn.hutool.core.io.FileUtil;
import com.lucy.viewer.constant.ViewerConst;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author kindear
 * 启动执行
 */
@Slf4j
@Component
@AllArgsConstructor
public class ViewerStartRunner implements ApplicationRunner {

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 清空文件
        log.info("---清空临时文件目录--");
        FileUtil.clean(ViewerConst.tempFilePath());
    }
}
